package com.wffz.controller;

import com.wffz.po.WffzConfig;
import com.wffz.service.WffzConfigService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
public class LoginController {
    private String prefix = "login";

    @Resource
    private WffzConfigService configService;


    @RequestMapping("/login")
    public String login() {
        return prefix + "/login";
    }

    @RequestMapping("/register")
    public String register(String rcode, Model model) {
        String key = "register_amount";
        WffzConfig config = configService.getConfigByKey(key);
        String awayBalance = "0";
        if (config!=null){
            awayBalance = config.getConfigValue();
        }
        model.addAttribute("rcode", rcode);
        model.addAttribute("away_balance",awayBalance);
        return prefix + "/register";
    }

    @RequestMapping("/forget")
    public String forget() {
        return prefix + "/forget";
    }
}
